﻿using System;
using System.Runtime.Serialization;

namespace Simhopp.Common
{
    /// <summary>
    /// The LoginInfo class provides user account information.
    /// </summary>
    ///
    /// 
     

    //Changed the name of this class to LogOnInfo instead of LoginInfo since FxCop recommended it.
    [Serializable]
    public class LogOnInfo : ISerializable
    {
        #region FIELD REGION
        private String userName;
        private String password;
        #endregion
        #region CONSTRUCTOR REGION
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="username">The username in the submitted account information.</param>
        /// <param name="password">The password in the submitted account information.</param>
        public LogOnInfo(String username = "", String password = "")
        {
            this.userName = username;
            this.password = password;
        }
        #endregion
        #region PROPERTY REGION
        /// <summary>
        /// Property Username gets or sets the username for the submitted account information.
        /// </summary>
        public String UserName
        {
            get { return userName; }
            set { userName = value; }
        }
        /// <summary>
        /// Property Password gets or sets the password for the submitted account information.
        /// </summary>
        public string Password
        {
            get { return password; }
            set { password = value; }
        }
        #endregion
        #region SERIALIZE/DESERIALIZE REGION
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Username", userName, typeof(String));
            info.AddValue("Password", password, typeof(String));
        }
        protected LogOnInfo(SerializationInfo info, StreamingContext context)
        {
            userName = (String)info.GetValue("Username", typeof(String));
            password = (String)info.GetValue("Password", typeof(String));
        }
        #endregion
    }
}
